home *** CD-ROM | disk | FTP | other *** search
/ MacFormat 1999 Spring / macformat-077.iso / Shareware Plus / Development / Akua Sweets 131 / Akua Sweets Examples / System / Input State < prev    next >
Encoding:
Text File  |  1999-03-04  |  1.0 KB  |  52 lines  |  [TEXT/ToyS]

  1. property kasLoc : {0, 0}
  2.  
  3. global gasInfo -- Display
  4.  
  5.  
  6. on run
  7.     set gasInfo to ¬
  8.         display info titled ("Input State V1.0") ¬
  9.             located at kasLoc
  10. end run
  11.  
  12.  
  13. on msg(txt, lineNo)
  14.     set newLoc to ¬
  15.         screen location of ¬
  16.         (display info gasInfo message txt at line lineNo using font "Monaco" using size 9)
  17.     
  18.     if (newLoc is not kasLoc) then ¬
  19.         set kasLoc to newLoc
  20. end msg
  21.  
  22.  
  23. on idle
  24.     set myState to input state
  25.     
  26.     msg("Conglomerate: " & conglomerate of myState, 1)
  27.     msg("Mouse X     : " & item 1 of pointer location of myState, 2)
  28.     msg("Mouse Y     : " & item 2 of pointer location of myState, 3)
  29.     msg("Modifiers   : " & modifier keys of myState, 4)
  30.     msg("Transient   : " & transient keys of myState, 5)
  31.     
  32.     set kc to keys down of myState
  33.     
  34.     msg("Keys        : " & kc, 6)
  35.     
  36.     if (kc is not "") then
  37.         set ka to (ASCII number kc)
  38.         msg("ASCII       : " & ka, 7)
  39.         msg("ASCII hex   : " & (hex convert source value ka), 8)
  40.     end if
  41.     
  42.     return 1
  43. end idle
  44.  
  45.  
  46. on quit
  47.     set kasLoc to ¬
  48.         screen location of ¬
  49.         (display info gasInfo with disposal)
  50.     continue quit
  51. end quit
  52.